#ifndef __MAIN_H_
#define __MAIN_H_

#include <dirent.h>
#include <sys/statfs.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/in.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <errno.h>
#include <time.h>
#include <pthread.h>
#include <sys/inotify.h>
#include <uci.h>
#include <openssl/md5.h>

//系统库
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <assert.h>
#include <memory.h>

//自定义库
#include "debug.h"
//utils
#include "utils/util.h"
#include "utils/queue.h"
#include "utils/map.h"
#include "utils/uthash.h"
#include "utils/charutil.h"
#include "utils/cJSON.h"
//socket
#include "socket/poll.h"
#include "socket/routerserver.h"
#include "socket/routerclient.h"
//core
#include "core/routerworker.h"
#include "core/msg.h"

#define OUT_DEBUG(level, fmt, arg...)                      \
	do                                                     \
	{                                                      \
		cwprintf(level, "[ %s +%d %s() ]	" fmt,         \
				 __FILE__, __LINE__, __FUNCTION__, ##arg); \
	} while (0);

#define DEBUG 1
#define INFO 2
#define MIND 3
#define WARN 4
#define BUFF_SIZE 102400

#define DEVFILE "/tmp/.flow/data"

int interval;

char Server[128];
int Port;
int HeartBeat;
int serverfd;
int serverlink;
int serverreg;

int init_value(void);
int shell_cmd(char *cmd, char *value);
char *shell_cmd_change(char *cmd);
int cwprintf(int level, const char *fmt, ...);
char *get_value_change(char *cmd);

#endif
